Skip to content

Conversation

kotlarmilos
Copy link
Member

@kotlarmilos kotlarmilos commented Oct 16, 2025

Description

This PR updates code-versioning and debugger/DAC paths with FEATURE_CODE_VERSIONING and provides stubs where needed. Code versioning was moved under tiered compilation in #120583, which is disabled for Apple mobile targets that caused build errors.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR guards code-versioning, ReJIT, and related debugger/DAC paths with FEATURE_CODE_VERSIONING, adding stubs that return E_NOTIMPL when the feature is absent to prevent build errors on Apple mobile targets where tiered compilation (and thus code versioning) is disabled.

  • Adds FEATURE_CODE_VERSIONING conditionals around code-versioning logic in perfmap, JIT interface, ETW events, debugger, DAC, and RS (debugger) components.
  • Introduces E_NOTIMPL fallbacks for APIs that depend on code versioning when the feature is not compiled.
  • Adjusts data structures and class members to compile cleanly without code versioning support.

Reviewed Changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/coreclr/vm/perfmap.cpp Wraps native code version resolution in FEATURE_CODE_VERSIONING.
src/coreclr/vm/jitinterface.cpp Guards helper resolution logic that depends on code versioning.
src/coreclr/vm/eventtrace.cpp Adds conditional emission of IL-to-native map and rich debug info events.
src/coreclr/inc/dacvars.h Exposes a DAC variable only when code versioning is enabled.
src/coreclr/debug/inc/dbgipcevents.h Guards VMPTRs for versioning nodes.
src/coreclr/debug/inc/dacdbiinterface.h Conditionally declares IL/native code version node accessors.
src/coreclr/debug/ee/functioninfo.cpp Gates IL map selection and fixes a variable name in a fallback path.
src/coreclr/debug/ee/debugger.h Makes helper method private/public only when feature enabled.
src/coreclr/debug/ee/debugger.cpp Adds guarded behavior and E_NOTIMPL stubs for deoptimization APIs.
src/coreclr/debug/di/rsthread.cpp Guards ReJIT IL code access in value enumeration and frame construction.
src/coreclr/debug/di/rsstackwalk.cpp Conditionally fetches ReJIT IL code during stack walking.
src/coreclr/debug/di/rspriv.h Wraps ReJIT-related forward declarations and members.
src/coreclr/debug/di/rsfunction.cpp Guards ReJIT IL code table and related methods; adds E_NOTIMPL fallback.
src/coreclr/debug/di/module.cpp Wraps CordbReJitILCode implementation.
src/coreclr/debug/daccess/request.cpp Adds guarded implementations with E_NOTIMPL fallbacks for ReJIT queries.
src/coreclr/debug/daccess/dacdbiimpl.h Moves versioning-related declarations under feature flag.
src/coreclr/debug/daccess/dacdbiimpl.cpp Segregates versioning node accessors and reintroduces stubs outside the guard.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

Tagging subscribers to this area: @mangod9
See info in area-owners.md if you want to be subscribed.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
m_iMax = localsCount;
#else
m_iMax = 0;
#endif // FEATURE_CODE_VERSIONING
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#endif // FEATURE_CODE_VERSIONING
m_iMax = 0;
#ifdef FEATURE_CODE_VERSIONING
CordbReJitILCode* pCode = jil->GetReJitILCode();
if (pCode != NULL)
{
IfFailRet(pCode->GetLocalVarSig(NULL, &localsCount));
// Grab the number of locals for the size of the enumeration.
m_iMax = localsCount;
#endif // FEATURE_CODE_VERSIONING

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't look resolve. Did I miss why this can't happen?

kotlarmilos and others added 4 commits October 17, 2025 09:53
Co-authored-by: Aaron Robinson <arobins@microsoft.com>
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
@kotlarmilos
Copy link
Member Author

/azp run runtime-extra-platforms

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@kotlarmilos
Copy link
Member Author

/azp run runtime-extra-platforms

Copy link

Azure Pipelines successfully started running 1 pipeline(s).


SOSDacEnter();

*pRejitId = -1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
*pRejitId = -1;
*pRejitId = -1;
hr = S_FALSE;

Comment on lines +4675 to +4680
else
{
hr = S_FALSE;
}

#else
hr = S_FALSE;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
hr = S_FALSE;

Remove this and the else branch above.

m_iMax = localsCount;
#else
m_iMax = 0;
#endif // FEATURE_CODE_VERSIONING
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't look resolve. Did I miss why this can't happen?

}

{
CodeVersionManager::LockHolder codeVersioningLockHolder;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you confirmed this lock isn't needed here? The GetCodeHeapIterator() does take its own lock, but I'm not sure we ever confirmed the CodeVersionManager::LockHolder can be removed.

Comment on lines +7263 to +7268
#ifdef FEATURE_REJIT
PTR_Module pModule = vmModule.GetDacPtr();
if (pModule == NULL || pOptimizationsDisabled == NULL || TypeFromToken(methodTk) != mdtMethodDef)
{
return E_INVALIDARG;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#ifdef FEATURE_REJIT
PTR_Module pModule = vmModule.GetDacPtr();
if (pModule == NULL || pOptimizationsDisabled == NULL || TypeFromToken(methodTk) != mdtMethodDef)
{
return E_INVALIDARG;
}
PTR_Module pModule = vmModule.GetDacPtr();
if (pModule == NULL || pOptimizationsDisabled == NULL || TypeFromToken(methodTk) != mdtMethodDef)
{
return E_INVALIDARG;
}
#ifdef FEATURE_REJIT

#else
pReJitData->rejitID = rejitId;
pReJitData->flags = DacpReJitData2::kActive;
pReJitData->il = 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pReJitData->il = 0;
pReJitData->il = pMD->GetILHeader();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants